package me.hushuang.webb.back.mapper;

import me.hushuang.webb.back.model.UrlFilter;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 *
 */
public interface UrlFilterMapper {

    @Insert("insert into sys_url_filter(name, url, roles, permissions) values(#{name}, #{url}, #{roles}, #{permissions})")
    int createUrlFilter(final UrlFilter urlFilter);

    @Update("update sys_url_filter set name=#{name},url=#{url},roles=#{roles},permissions=#{permissions} where id=#{id}")
    UrlFilter updateUrlFilter(UrlFilter urlFilter);

    @Delete("delete from sys_url_filter where id= #{id}")
    void deleteUrlFilter(Long urlFilterId);

    @Select("select id, name, url, roles, permissions from sys_url_filter where id=#{id}")
    UrlFilter findOne(Long urlFilterId);

    @Select("select id, name, url, roles, permissions from sys_url_filter")
    List<UrlFilter> findAll();

}
